home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / qwik30.arc / QFILLS.INC < prev    next >
Text File  |  1991-01-09  |  13KB  |  198 lines

  1. { Qfills.inc - QfillC, Qfill, Qattr, QattrC                 ver 3.0, 08-31-87 }
  2. { After Qinit is executed, this procedure does fast screen writes and works
  3.   on any IBM adapter.  It also has the feature of leaving the attribute alone 
  4.   by setting Attr<0; then Qfill will just overwrite the display using the   
  5.   current attributes (Qattr will simply abort the procedure).  The upper left 
  6.   column is 1,1.  Cols and Rows can range from 1 to screen limits.  Example 
  7.   applications for Qfill is a fast screen clear or clear EOL; for Qattr is 
  8.   changing the highlighted cursor in pull down menus without the need of a 
  9.   string.  Please limit Cols to the number in one row (<200).  
  10.   Read MODIFICATIONS in QWIK30.DOC for possible changes in this file. }
  11.  
  12. { QfillsDisp - Subroutine for all Qfills procedures         ver 3.0, 08-31-87 }
  13. procedure QfillsDisp;
  14. begin
  15. Inline(                  {Assembly by Inline 08/17/87 00:31}
  16.   $48/                   {       dec   ax               ;Convert to 0-?? range}
  17.   $31/$D2/               {       xor   dx,dx            ;Set DX=0}
  18.   $8E/$C2/               {       mov   es,dx            ;Set ES=0}
  19.   $26/                   {       es:                    ;Segment override}
  20.   $8B/$16/$4A/$04/       {       mov   dx,[$044A]       ;Get CRT columns}
  21.   $F6/$E2/               {       mul   dl               ;(CRT columns)*(Row-1)}
  22.   $D1/$E0/               {       shl   ax,1             ;Mult by 2}
  23.   $01/$C7/               {       add   di,ax            ;Dest offset in DI}
  24.   $88/$E8/               {       mov   al,ch            ;Move attr to AH}
  25.   $30/$ED/               {       xor   ch,ch            ;Set CH=0}
  26.   $29/$CA/               {       sub   dx,cx            ;Subract Cols}
  27.   $D1/$E2/               {       shl   dx,1             ;Mult by 2}
  28.   $52/                   {       push  dx               ;Save # to next row}
  29.   $51/                   {       push  cx               ;Save # of Cols}
  30.                          {                              ;}
  31.   $85/$F6/               {       test  si,si            ;If Rows<=0 ...}
  32.   $7E/$31/               {       jle   DoneS            ;   nothing to do}
  33.   $85/$C9/               {       test  cx,cx            ;If Cols<=0 ...}
  34.   $7E/$2D/               {       jle   DoneS            ;   nothing to do}
  35.                          {                              ;}
  36.   $88/$DC/               {       mov   ah,bl            ;Move attr to AH}
  37.   $FC/                   {       cld                    ;Set DF to increment}
  38.   $3A/$2E/>QWAIT/        {       cmp   ch,[>Qwait]      ;Check need for wait}
  39.   $8E/$06/>QSEG/         {       mov   es,[>Qseg]       ;ES:DI dest pointer}
  40.   $75/$29/               {       jne   Color            ;  use Color routine}
  41.   $84/$FF/               {       test  bh,bh            ;If Attr<0 ...}
  42.   $78/$0E/               {       js    Mono1            ;  use char only}
  43.                          {                              ;}
  44.                          {; -- Mono routine; Attr, Char and No Wait--}
  45.   $89/$CA/               {       mov   dx,cx            ;Save Cols in DX}
  46.   $F2/$AB/               {Mono2: rep   stosw            ;To dest & inc DI 2}
  47.   $4E/                   {       dec   si               ;Decrement rows left}
  48.   $74/$15/               {       jz    DoneS            ;If Rows=0, done}
  49.   $89/$D1/               {       mov   cx,dx            ;Restore Cols}
  50.   $03/$7E/$FA/           {       add   di,[bp-$06]      ;Dest for next row}
  51.   $EB/$F4/               {       jmp   SHORT Mono2      ;Next row}
  52.                          {                              ;}
  53.                          {; -- Mono routine; Char/Attr Only and No Wait--}
  54.                          {; Algorithm packs in an extra STOSB per LOOP}
  55.   $41/                   {Mono1: inc   cx               ;Bump CX for odd col}
  56.   $89/$CA/               {       mov   dx,cx            ;Save Cols in DX}
  57.   $D1/$E9/               {Mon1a: shr   cx,1             ;Divide counter by 2}
  58.                          {                              ; CF=0 if odd count}
  59.   $73/$02/               {       jnc   Mon1c            ;Jump if odd count}
  60.                          {                              ;}
  61.   $AA/                   {Mon1b: stosb                  ;To dest & inc DI 1}
  62.   $47/                   {       inc   di               ;Pass up attr/char}
  63.   $AA/                   {Mon1c: stosb                  ;To dest & inc DI 1}
  64.   $47/                   {       inc   di               ;Pass up attr/char}
  65.   $E2/$FA/               {       loop  Mon1b            ;Loop until CX=0}
  66.   $4E/                   {       dec   si               ;Decrement rows left}
  67.   $7E/$58/               {DoneS: jle   Done             ;If Rows=0, done}
  68.   $89/$D1/               {       mov   cx,dx            ;Restore Cols}
  69.   $03/$7E/$FA/           {       add   di,[bp-$06]      ;Dest for next row}
  70.   $EB/$EC/               {       jmp   SHORT Mon1a      ;Next row}
  71.                          {                              ;}
  72.   $BA/$DA/$03/           {Color: mov   dx,$03DA         ;CGA port}
  73.   $88/$C3/               {       mov   bl,al            ;Save char in BL}
  74.   $84/$FF/               {       test  bh,bh            ;If Attr<0 ...}
  75.   $78/$27/               {       js    Col1a            ;  use char/attr only}
  76.                          {                              ;}
  77.                          {; -- Color routine; Attr, Char and Wait --}
  78.   $FA/                   {Col2a: cli                    ;Disable interrupts}
  79.   $EC/                   {E4in2: in    al,dx            ;Check CGA status}
  80.   $A8/$08/               {       test  al,$08           ;If #3 bit clear ...}
  81.   $74/$07/               {       jz    Col2b            ;  check #0 bit.}
  82.   $88/$D8/               {       mov   al,bl            ;Move char back in AL}
  83.   $F2/$AB/               {       rep   stosw            ;Quick storage}
  84.   $FB/                   {       sti                    ;Enable interrupts}
  85.   $EB/$0F/               {       jmp   SHORT Col2c      ;  finished row}
  86.   $D0/$D8/               {Col2b: rcr   al,1             ;If #0 bit set ...}
  87.   $72/$F0/               {       jc    E4in2            ;  try again for $E4}
  88.   $EC/                   {E5in2: in    al,dx            ;Check CGA status}
  89.   $D0/$D8/               {       rcr   al,1             ;If #0 bit clear ...}
  90.   $73/$FB/               {       jnc   E5in2            ;  try again for $E5}
  91.   $88/$D8/               {       mov   al,bl            ;Move char back in AL}
  92.   $AB/                   {       stosw                  ;Put in dest & inc DI}
  93.   $FB/                   {       sti                    ;Enable interrupts}
  94.   $E2/$E4/               {       loop  Col2a            ;Loop till CX=0}
  95.   $4E/                   {Col2c: dec   si               ;Decrement rows left}
  96.   $74/$29/               {       jz    Done             ;If Rows=0, done}
  97.   $8B/$4E/$F8/           {       mov   cx,[bp-$08]      ;Restore Cols}
  98.   $03/$7E/$FA/           {       add   di,[bp-$06]      ;Dest for next row}
  99.   $EB/$D9/               {       jmp   SHORT Col2a      ;Next row}
  100.                          {                              ;}
  101.                          {; -- Color routine; Char/Attr only and Wait --}
  102.   $FA/                   {Col1a: cli                    ;Disable interrupts}
  103.   $EC/                   {E4in1: in    al,dx            ;Check CGA status}
  104.   $A8/$08/               {       test  al,$08           ;If #3 bit set ...}
  105.   $75/$09/               {       jnz   Col1b            ;  skip wait.}
  106.   $D0/$D8/               {       rcr   al,1             ;If #0 bit set ...}
  107.   $72/$F7/               {       jc    E4in1            ;  try again for $E4}
  108.   $EC/                   {E5in1: in    al,dx            ;Check CGA status}
  109.   $D0/$D8/               {       rcr   al,1             ;If #0 bit clear ...}
  110.   $73/$FB/               {       jnc   E5in1            ;  try again for $E5}
  111.   $88/$D8/               {Col1b: mov   al,bl            ;Move char/attr in AL}
  112.   $AA/                   {       stosb                  ;Put in dest & inc DI}
  113.   $FB/                   {       sti                    ;Enable interrupts}
  114.   $47/                   {       inc   di               ;Pass up attr/char}
  115.   $E2/$EA/               {       loop  Col1a            ;Loop till CX=0}
  116.   $4E/                   {       dec   si               ;Decrement rows left}
  117.   $74/$08/               {       jz    Done             ;If Rows=0, done}
  118.   $8B/$4E/$F8/           {       mov   cx,[bp-$08]      ;Restore Cols}
  119.   $03/$7E/$FA/           {       add   di,[bp-$06]      ;Dest for next row}
  120.   $EB/$DF/               {       jmp   SHORT Col1a      ;Next row}
  121.                          {                              ;}
  122.   $81/$C4/$04/$00/       {Done:  add   sp,$0004         ;Restore stack ptr}
  123.   $C3);                  {       ret                    ;Return to call}
  124. end;
  125.  
  126. { QfillC - Quick screen repetitive fill, self-centering     ver 3.0, 08-31-87 }
  127. procedure QfillC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer; Ch: char);
  128. begin
  129. Inline(                  {Assembly by Inline 08/17/87 00:31}
  130.   $8B/$46/<ROW/          {       mov   ax,[bp+<Row]     ;Move row}
  131.   $8B/$7E/<COLL/         {       mov   di,[bp+<ColL]    ;Move left col}
  132.   $03/$7E/<COLR/         {       add   di,[bp+<ColR]    ;Add right col}
  133.   $4F/                   {       dec   di               ;Convert to 0-?? range}
  134.   $8B/$76/<ROWS/         {       mov   si,[bp+<Rows]    ;Move number of rows}
  135.   $8B/$4E/<COLS/         {       mov   cx,[bp+<Cols]    ;Move number of cols}
  136.   $29/$CF/               {       sub   di,cx            ;Offset calc'd in DI}
  137.   $81/$E7/$FE/$FF/       {       and   di,$FFFE         ;Make even}
  138.   $8B/$5E/<ATTR/         {       mov   bx,[bp+<Attr]    ;Move attr to BX}
  139.   $8A/$6E/<CH/           {       mov   ch,[bp+<Ch]      ;Move char to CH}
  140.   $E8/>QFILLSDISP-*+5);  {       call  >QfillsDisp-*+5  ;Call QfillsDisp}
  141. end;
  142.  
  143. { Qfill - Quick screen repetitive fill                      ver 3.0, 08-31-87 }
  144. procedure Qfill (Row, Col, Rows, Cols: byte; Attr: integer; Ch: char);
  145. begin
  146. Inline(                  {Assembly by Inline 08/17/87 00:31}
  147.   $8B/$46/<ROW/          {       mov   ax,[bp+<Row]     ;Move row}
  148.   $8B/$7E/<COL/          {       mov   di,[bp+<Col]     ;Move col}
  149.   $4F/                   {       dec   di               ;Convert to 0-?? range}
  150.   $D1/$E7/               {       shl   di,1             ;Mult by 2}
  151.   $8B/$76/<ROWS/         {       mov   si,[bp+<Rows]    ;Move number of rows}
  152.   $8A/$4E/<COLS/         {       mov   cl,[bp+<Cols]    ;Move number of cols}
  153.   $8B/$5E/<ATTR/         {       mov   bx,[bp+<Attr]    ;Move attr to BX}
  154.   $8A/$6E/<CH/           {       mov   ch,[bp+<Ch]      ;Move char to CH}
  155.   $E8/>QFILLSDISP-*+5);  {       call  >QfillsDisp-*+5  ;Call QfillsDisp}
  156. end;
  157.  
  158. { Qattr - Quick screen attribute change                     ver 3.0, 08-31-87 }
  159. procedure Qattr (Row, Col, Rows, Cols: byte; Attr: integer);
  160. begin
  161. Inline(                  {Assembly by Inline 08/17/87 00:31}
  162.   $8B/$46/<ROW/          {       mov   ax,[bp+<Row]     ;Move row}
  163.   $8B/$7E/<COL/          {       mov   di,[bp+<Col]     ;Move col}
  164.   $4F/                   {       dec   di               ;Convert to 0-?? range}
  165.   $D1/$E7/               {       shl   di,1             ;Mult by 2}
  166.   $47/                   {       inc   di               ;Pass up char}
  167.   $8B/$76/<ROWS/         {       mov   si,[bp+<Rows]    ;Move number of rows}
  168.   $8A/$4E/<COLS/         {       mov   cl,[bp+<Cols]    ;Move number of cols}
  169.   $8B/$5E/<ATTR/         {       mov   bx,[bp+<Attr]    ;Move attr to BX}
  170.   $84/$FF/               {       test  bh,bh            ;If Attr<0 ...}
  171.   $78/$07/               {       js    exit             ;  nothing to do.}
  172.   $88/$DD/               {       mov   ch,bl            ;Move attr in CH}
  173.   $B7/$80/               {       mov   bh,$80           ;Make BH negative}
  174.   $E8/>QFILLSDISP-*+5    {       call  >QfillsDisp-*+5  ;Call QfillsDisp}
  175.  );                      {Exit:}
  176. end;
  177.  
  178. { QattrC - Quick screen attribute change, self-centering    ver 3.0, 08-31-87 }
  179. procedure QattrC (Row, ColL, ColR, Rows, Cols: byte; Attr: integer);
  180. begin
  181. Inline(                  {Assembly by Inline 08/17/87 00:31}
  182.   $8B/$46/<ROW/          {       mov   ax,[bp+<Row]     ;Move row}
  183.   $8B/$7E/<COLL/         {       mov   di,[bp+<ColL]    ;Move left col}
  184.   $03/$7E/<COLR/         {       add   di,[bp+<ColR]    ;Add right col}
  185.   $4F/                   {       dec   di               ;Convert to 0-?? range}
  186.   $8B/$76/<ROWS/         {       mov   si,[bp+<Rows]    ;Move number of rows}
  187.   $8B/$4E/<COLS/         {       mov   cx,[bp+<Cols]    ;Move number of cols}
  188.   $29/$CF/               {       sub   di,cx            ;Offset calc'd in DI}
  189.   $81/$CF/$01/$00/       {       or    di,$0001         ;Make odd;pass up char}
  190.   $8B/$5E/<ATTR/         {       mov   bx,[bp+<Attr]    ;Move attr to BX}
  191.   $84/$FF/               {       test  bh,bh            ;If Attr<0 ...}
  192.   $78/$07/               {       js    Exit             ;  nothing to do.}
  193.   $88/$DD/               {       mov   ch,bl            ;Move attr in CH}
  194.   $B7/$80/               {       mov   bh,$80           ;Make BH negative}
  195.   $E8/>QFILLSDISP-*+5    {       call  >QfillsDisp-*+5  ;Call QfillsDisp}
  196.  );                      {Exit:}
  197. end;
  198.